/**
 * 
 */
package com.ys.ylideas.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Red
 *
 */
public class StringDealUtil {
	
	// 高亮搜索词
	public static String highLightWord(String content,String kw){
		String style = "<span class=\"searchWord\">" + kw + "</span>";
		String highLight = content.replace(kw, style);	
		return highLight;
	}
	
	public static int getInnerWord(String content){
	    int code = 0;
	    Pattern p = Pattern.compile("(\\[[^\\]]*\\])");
	    Matcher m = p.matcher(content);    
	    if(m.find()){
	      String str = m.group().substring(1,m.group().length()-1);
	      code = Integer.parseInt(str);
	    }
	    return code;
	}  
}
